package com.zzh.model

import com.zzh.model.builder.BuilderDemo
import com.zzh.model.factory.FactoryOneDemo
import com.zzh.model.prototype.PrototypeDemo
import com.zzh.model.proxy.ProxyDemo
import com.zzh.model.singleton.SingletonDemo
import org.junit.Test

import org.junit.Assert.*

/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * See [testing documentation](http://d.android.com/tools/testing).
 */
class ExampleUnitTest {
    @Test
    fun addition_isCorrect() {
        // 单利
        SingletonDemo.getInstance()
        SingletonDemo.getInstanceOne()
        SingletonDemo.getInstanceTwo()
        // 原型
        var dataBean = PrototypeDemo.getInstance().config("zhagnzhiao", "nihao")
        println("原>>${dataBean}>>${dataBean.hashCode()}")
        var cloneDataBean = PrototypeDemo.getInstance().cloneDataBean(dataBean)
        println("clone>>${cloneDataBean}>>${cloneDataBean.hashCode()}")
        // 简单工厂模式
        FactoryOneDemo.createClient(FactoryOneDemo.Constant.ONE).show()
        FactoryOneDemo.createClient(FactoryOneDemo.Constant.TWO).show()
        // 建造者模式
        BuilderDemo.MyBuilder().setName("zhangzhihao").setValue("shide").setAge("12").create().show()
        // 静态代理
        ProxyDemo.ProxyWorker.getInstance().start()




        assertEquals(4, 2 + 2)
    }
}